1. Field of the Invention
The present invention relates to a method of generating hash codes to identify objects in a computer system and enables object hash codes to be assigned to pinned objects.
2. Description of Related Art
As described in Laid-open Patent Publication No. 2010-204955, a hash value is generated and assigned to an object generated using Java® and allocated to a heap area in order to track and locate the object. More specifically, a computer system generates a table including generated hash values and the objects' references. An object is located by looking up the hash value in the table.
The hash value is calculated from the address of the object. The hash value is stored, for example, in a 15-bit area in the object header. Typically, there is a two-bit area in the object header which has the following meaning:    “00”=Not hashed. The object does not yet have a hash code.    “01”=Hashed. The object hash code can be calculated from the object address.    “10”=Hashed and moved. An object hash code has been added to the object.
When object hash codes are generated on the basis of object addresses, a conflict occurs between object hash codes because of the limited number of object address values, and performance degrades.
To increase the variation in object hash codes, a seed value is added to a heap to generate an object hash code (O. Agesen, “Space and Time-Efficient Hashing of Garbage-Collected Objects”, Theory and Practice of Object Systems, 1998). This seed is used for young (nursery) heap area in generational garbage collection (GC).
The technique described in “Space and Time-Efficient Hashing of Garbage-Collected Objects” is not used for other types of GC, such as GC in a non-generational heap area. It also does not cope with object pinning.